package com.rxyb.quartz.config;

import java.util.HashMap;
import java.util.Map;
/**
 * 响应码
 *
 * @author lcf
 */
public class RspResult extends HashMap<String, Object> {

	private static final long serialVersionUID = 1L;

	public RspResult() {
		put("code", 0);
	}

	public static RspResult error() {
		return error(500, "未知异常，请联系管理员");
	}

	public static RspResult error(String msg) {
		return error(500, msg);
	}

	public static RspResult error(int code, String msg) {
		RspResult r = new RspResult();
		r.put("code", code);
		r.put("msg", msg);
		return r;
	}

	public static RspResult ok(Object msg) {
		RspResult r = new RspResult();
		r.put("msg", msg);
		return r;
	}


	public static RspResult ok(Map<String, Object> map) {
		RspResult r = new RspResult();
		r.putAll(map);
		return r;
	}

	public static RspResult ok() {
		return new RspResult();
	}

	@Override
	public RspResult put(String key, Object value) {
		super.put(key, value);
		return this;
	}
}